package com.shopping.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@TableName("products")
public class Product {
    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField("name")
    private String name;

    @TableField("description")
    private String description;

    @TableField("price")
    private BigDecimal price;

    @TableField("stock")
    private Integer stock;

    @TableField("type")
    private String type;

    @TableField("image_url")
    private String imageUrl;

    @TableField("is_recommended")
    private Boolean recommended;

    @TableField("status")
    private String status;

    @TableField("product_points")
    private Integer productPoints;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    public enum ProductType {
        ELECTRONICS("电子产品"),
        CLOTHING("服装"),
        FOOD("食品"),
        BOOKS("图书"),
        HOME("家居"),
        SPORTS("运动"),
        BEAUTY("美妆"),
        OTHER("其他");

        private final String displayName;

        ProductType(String displayName) {
            this.displayName = displayName;
        }

        public String getDisplayName() {
            return displayName;
        }
    }

    public enum Status {
        ON_SALE("上架"),
        OFF_SALE("下架");

        private final String displayName;

        Status(String displayName) {
            this.displayName = displayName;
        }

        public String getDisplayName() {
            return displayName;
        }
    }
}